package com.web.server.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping(value = "api/v1")
public class WebService {
    @GetMapping("/hello/{gwDate}")
    public String hello(@PathVariable String gwDate, Model model) {
        String gwOI = "2000";
        model.addAttribute("gwDate", gwDate);
        model.addAttribute("gwOI", gwOI);
        return "hello";
    }

    @GetMapping("/world/{gwDate}/{gwMeterAddr}")
    public String world(@PathVariable String gwDate,
                        @PathVariable String gwMeterAddr,
                        Model model) {
        String gwOI = "2000";
        model.addAttribute("gwDate", gwDate);
        model.addAttribute("gwMeterAddr", gwMeterAddr);
        model.addAttribute("gwOI", gwOI);
        return "world";
    }
}
